package com.example.studyspot.config;

import com.example.studyspot.common.AuthConstants;
import io.jsonwebtoken.security.Keys;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.crypto.SecretKey;
import java.nio.charset.StandardCharsets;

@Configuration
public class AppConfig {
    @Bean
    public Long expiration() {
        return 3600L;
    }

    @Bean
    public String separator() {
        return "/";
    }

    @Bean
    public ThreadLocal< Long > startTime() {
        return new ThreadLocal<>();
    }

    @Bean
    public SecretKey secretKey() {
        return Keys.hmacShaKeyFor(AuthConstants.SECRET.getBytes(StandardCharsets.UTF_8));
    }
}
